# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        Young  
# Name:         hmwk01
# Description:  定义类、属性和方法
# Author:       asus
# Date:         2019/3/13
#-------------------------------------------------------------------------------


class Person:
    def __init__(self,name,sex,age):
        self.name = name
        self.sex = sex
        self.age = age

    def getinfo(self):
        # 获取人的基本信息
        return self.name,self.sex,self.age

    def greet(self):
        # 打招呼模板输出信息
        return "Hello,I'm {name},a {age} years old {sex}".format(name=self.name,age=self.age,sex=self.sex)


class Teacher:
    def __init__(self,name,major,school):
        self.name = name
        self.major = major
        self.school = school

    def getmajor(self):
        # 获取老师任教科目
        return self.major

    def getschool(self):
        # 获取老师所在学校
        return self.school

    def outinfo(self):
        # 输出老师基本信息
        return "{name}老师，在{school}任教{major}".format(name=self.name,school=self.school,major=self.major)


class Student:
    def __init__(self,name,depart,grade,number):
        self.name = name
        self.depart = depart
        self.grade = grade
        self.number = number

    def getname(self):
        # 获取学生名字
        return self.name

    def getdepart(self):
        # 获取学生学院
        return self.depart

    def outinfo(self):
        # 输出学生基本信息
        return "学号为:{number} 的 {name}是{depart},{grade}的学生".format(name=self.name,depart=self.depart,
                                                              grade=self.grade,number=self.number)


if __name__ == '__main__':
    person1 = Person('yzb', 'boy', 22)
    print(person1.getinfo())
    print(person1.greet())
    print('---------------')
    teacher1 = Teacher('X','计算机网络','湖南工业大学')
    print(teacher1.getmajor())
    print(teacher1.getschool())
    print(teacher1.outinfo())
    print('---------------')
    stu = Student('Y','商学院','大一','123456')
    print(stu.outinfo())




